using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy_StunnedState : EnemyStateBase
{
    private Enemy_VFX enemy_VFX;
    public Enemy_StunnedState(Enemy enemy, StateMachine stateMachine, string animName) : base(enemy, stateMachine, animName)
    {
        enemy_VFX = enemy.GetComponent<Enemy_VFX>();
    }
    public override void Enter()
    {
        base.Enter();
        //关闭攻击提示
        enemy_VFX.EnableAttackAlert(false);
        //将是否能够眩晕设置为否
        enemy.OnEnableStunnedWindow(false);
        stateTimer = enemy.stunnedDuration;
        enemy.SetVelocity(enemy.stunnedMovement.x * -enemy.facingDir, enemy.stunnedMovement.y);
        //处理翻转偏差
        enemy.HandleFlip(-enemy.facingDir);
    }
    public override void Update()
    {
        base.Update();
        if (stateTimer < 0)
        {
            stateMachine.ChangeState(enemy.battleState);
        }
    }

}
